package com.exchange.plugin.influx;

import org.influxdb.InfluxDB;
import org.influxdb.InfluxDBFactory;
import com.jfinal.kit.PropKit;
import com.jfinal.plugin.IPlugin;

public class InFluxDbPlugin implements IPlugin {
	
	public static InfluxDB influxDB;
	
	public InFluxDbPlugin() {
		
	}

	@Override
	public boolean start() {
		if(influxDB == null){
			influxDB = InfluxDBFactory.connect(PropKit.get("influxDbHost"), PropKit.get("influxDbUsername"), PropKit.get("influxDbPassword"));
		}
		return true;
	}

	@Override
	public boolean stop() {
		if(influxDB != null){
			influxDB.close();
		}
		return false;
	}

}
